//function VectorDetailCtrl ($scope, $location, $routeParams, $http, $rootScope, $dialogs, data, rest, $modalInstance) {
//    if (!$rootScope.hasOwnProperty('user')){
//        $location.path("/login");
//    }
//
//    //$scope.progress = [{"value":21,"type":"warning"},{"value":13,"type":"info"},{"value":9,"type":"success"},{"value":14,"type":"warning"}];
//    rest.query('vector', {uuid: data._uuid, limit: 1}).then(function(data) {
//        $scope.obj = data.objects[0];
//    });
//
//    $scope.close = function(result){
//        $modalInstance.dismiss('canceled');
//    };
//
//}
//

function VectorListCtrl($scope, $rootScope, $location, rest) {
//    if (!$rootScope.hasOwnProperty('user')){  // 验证用户登陆
//        $location.path("/login");
//    }
    $rootScope.moduleTitle = "vector";
    console.log($rootScope.moduleTitle);
    $scope.parameters = $location.search() || {};
    $scope.parameters.limit = cfg.limit;
    $scope.meta = {};
    // Pagination
    $scope.noOfPages = 7;
    $scope.currentPage = 4;
    $scope.maxSize = 5;

    $scope.setPage = function (pageNo) {
        $scope.currentPage = pageNo;
        $scope.parameters.limit = $scope.meta.limit || 20;
        $scope.parameters.offset = (pageNo - 1) * $scope.parameters.limit ;
        $scope.query();
    };
//
    $scope.query = function(){
        $rootScope.loading51 = true;
        rest.query('vector', $scope.parameters).then(function(data) {
            $scope.objects = data.objects;
            $scope.meta = data.meta;

            $scope.noOfPages = Math.floor($scope.meta.total_count / $scope.meta.limit) + 1;
            $scope.totalItems = $scope.meta.total_count;
            $scope.currentPage = Math.floor($scope.meta.offset / $scope.meta.limit) + 1;
            $rootScope.loading51 = false;
        });
    };
//
//
//    $scope.getMoreInfo = function(currentModel, objId){
//        var dlg = $dialogs.create(
//            '/static/js/views/detail/vector_more_info.html',
//            'VectorMoreInfoCtrl',
//            { currentModel: uriToID(currentModel), objId: uriToID(objId) },
//            {key: false,back: 'static', windowClass: 'modal modal-large'}
//        );
//
//        dlg.result.then(function(result){
//            $scope.query();
//        }, function(invoiceObj){
//            console.log(invoiceObj);
//        });
//    };
};

//function VectorMoreInfoCtrl($http, $rootScope, $routeParams, $scope, $location, $dialogs, common, data,rest, $modalInstance) {
//    if (!$rootScope.hasOwnProperty('user')){  // 验证用户登陆
//        $location.path("/login");
//    }
//    $scope.getMoreInfo = function(){
//        var postData = {currentModel:data.currentModel, objId: data.objId}
//        $http.post('/api/v1/other/get_more_info/', postData).success(function(data){
//            console.log( data);
//            if(data.status){
//                $scope.obj = data.obj;
//            }
//        });
//    };
//    $scope.getMoreInfo();
//    $scope.close = function(){
//        $modalInstance.dismiss('close');
//    };
//    $scope.save = function(){
//        $scope.close();
//    };
//};
//
